package www.rlicker.service.impl;

import www.rlicker.model.GuidePicture;

import java.util.Map;

import javax.annotation.Resource;

import www.rlicker.dao.IGuidePictureDao;

import org.springframework.stereotype.Service;

import www.rlicker.mybatis.Criteria;
import www.rlicker.service.IGuidePictureService;
import www.rlicker.utils.MessageConstant;
import www.rlicker.utils.TranslateToMap;

import java.util.List;

@Service
public class GuidePictureServiceImpl implements IGuidePictureService{


	public List<Map<String, Object>>  queryPage (Criteria<GuidePicture> param){
		List<GuidePicture> list = guidePictureRepository.queryPage(param);
			List<Map<String,Object>> map = TranslateToMap.convertListBean2ListMap(list,GuidePicture.class);
	return map;  }

	public Integer queryPageCount (Criteria<GuidePicture> param){
		return (Integer) guidePictureRepository.queryPageCount(param);
	}

	public GuidePicture  queryEntity (String id ){
		return guidePictureRepository.queryEntity(id);
	}

	public String deleteById (String id ){
		int result = guidePictureRepository.deleteById(id);
			if ( result != 1) {
					return MessageConstant.USER_TYPE_3;
			}
			return null;
	}

	public String insert(GuidePicture record ){
		int result = guidePictureRepository.insert(record);
			if ( result != 1) { 
					return MessageConstant.USER_TYPE_4;
			}
			return null;
	}

	public String update (Criteria<GuidePicture> param){
		int result = guidePictureRepository.update(param);
			if ( result != 1) { 
					return MessageConstant.USER_TYPE_5;
			}
			return null;
	}
	
	@Override
	public List<GuidePicture> queryPageList(Criteria<GuidePicture> param) {
		return guidePictureRepository.queryPage(param);
	}

	@Override
	public GuidePicture queryByType(Integer type) {
		return guidePictureRepository.queryByType(type);
	}

	@Resource
	private IGuidePictureDao guidePictureRepository;


}